#include "house.h"
#include "map.h"
#include <iostream>
#include <windows.h>
#include <conio.h>
using namespace std;

house::house()
/*konstruktor kelas house*/
{
	vector<int> Accessable_Dest;
	/*array of integer yang berisi kode dalam integer dari map-map yang bisa diakses melalui teleport dari house*/
	Accessable_Dest.push_back(1);
	for (int j=0;j<6;j++)
	{
		for (int k=0;k<6;k++)
		{
			mhouse[j][k]=' ';	
		}
	}
}

house::~house()
/* destruktor kelas house*/
{
}

house::house(const house& h)
/*copy konstruktor kelas house*/
{
}

vector<int> house::GetDestination()
/*fungsi getter untuk variabel accesable_dest()*/
{
	vector<int> a;
	a.push_back(0);
	return a; 
}

void house::Display(int xplayer,int yplayer, int player_direction,int xkurcharvest,int ykurcharvest,int kurcharvest_direction, int xkurcwater, int ykurcwater,int kurcwater_direction, int xkurcslash, int ykurcslash,int kurcslash_direction)
/*prosedur men-display interface dari house ke player*/
{
	char playerkiri = (char) 17;
	char playerkanan = (char) 16;
	char playeratas = (char) 30;
	char playerbawah = (char) 31;
	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	
	//system ("cls");
        gotoxy(0,0);
        for(int i = 1; i <= 16; i++)
            cout<< "               \n";
        gotoxy(0,0);
	//cout << endl;
	for(int i=0;i<=7;i++) {
		SetConsoleTextAttribute (hOut, BBI);
		cout << "_";
		SetConsoleTextAttribute (hOut, FW);
	}
	cout << endl;
	for (int i=0;i<6;i++)
	{
		SetConsoleTextAttribute (hOut, BBI);
		cout << "|";
		SetConsoleTextAttribute (hOut, FW);
		for (int j=0;j<6;j++)
		{	
			SetConsoleTextAttribute (hOut, BW);
			if(xplayer==j && yplayer==i && player_direction==0) {
				SetConsoleTextAttribute (hOut, FRI);
				cout << playerkiri;
				SetConsoleTextAttribute (hOut, FW);
			}else if(xplayer==j && yplayer==i && player_direction==1){
				SetConsoleTextAttribute (hOut, FRI);
				cout << playerkanan;
				SetConsoleTextAttribute (hOut, FW);
			}else if(xplayer==j && yplayer==i && player_direction==2){
				SetConsoleTextAttribute (hOut, FRI);
				cout << playeratas;
				SetConsoleTextAttribute (hOut, FW);
			}else if(xplayer==j && yplayer==i && player_direction==3){
				SetConsoleTextAttribute (hOut, FRI);
				cout << playerbawah;
				SetConsoleTextAttribute (hOut, FW);
			}else{
				cout<<mhouse[i][j];
			}
			SetConsoleTextAttribute (hOut, FW);
		}
		SetConsoleTextAttribute (hOut, BBI);
		cout << "|";
		SetConsoleTextAttribute (hOut, FW);
		cout  << endl;
	}
	for(int i=0;i<=7;i++) {
		SetConsoleTextAttribute (hOut, BBI);
		cout << "_";
		SetConsoleTextAttribute (hOut, FW);
	}
	cout << endl;
	cout << endl;
        gotoxy(0,17); cout<< "\t\t\t\t\t\t\t\t";
        gotoxy(0,17); cout<< ">";
}


